home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11764 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: hopper.acm.org!news
  2. From: varnk@e62.diebold.com (Ken Varn)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Help with the spawnlp function in TC++ 3.0
  5. Date: 26 Mar 1996 13:43:31 GMT
  6. Organization: Diebold
  7. Message-ID: <4j8sa3$1k0@HOPPER.ACM.ORG>
  8. References: <UokVxUJdkXxX088yn@CRIS.COM>
  9. NNTP-Posting-Host: 199.218.232.47
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.7
  13.  
  14. In article <UokVxUJdkXxX088yn@CRIS.COM>, SCLARK74@CRIS.COM says...
  15. />
  16. />Hello,
  17. />
  18. />I can't figure out why the following code will not work.  What I'm
  19. />trying to do is execute TCC from with in my C program and pass it the
  20. />file TEST.C on the command-line.  I can get TCC to execute perfectly but
  21. />no matter what I do, it always ignores the command-line argument.  Here's
  22. />the code.
  23. />
  24. />
  25. />---------------
  26. />#include <process.h>
  27. />#include <stdio.h>
  28. />#include <conio.h>
  29. />
  30. />void main(void)
  31. />{
  32. />   int result;
  33. />
  34. />   result = spawnlp(P_WAIT, "TCC", "TEST.C", NULL);
  35. />   if (result == -1)
  36. />   {
  37. />      perror("Error:");
  38. />      exit(1);
  39. />   }
  40. />}
  41. />
  42. />---------------
  43. />
  44. />What am I doing wrong here?  Thanks for any help!
  45.  
  46.  
  47. You are not specifying your arguments correctly.  Note that the argv[0] 
  48. argument must be the name of the program being run.  Argv[1] is the actual 
  49. start of the argument list.
  50.  
  51. Try this:
  52.  
  53.    result = spawnlp(P_WAIT, "TCC", "TCC", "TEST.C", NULL);
  54.  
  55.